package com.szxy.sso.feign;

import com.szxy.pojo.TbUser;
import com.szxy.utils.CartItem;
import com.szxy.utils.UserToken;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Auther:zwer
 * @Date:2019/9/12 15:54
 * @Description:com.szxy.sso.feign
 * @Version:1.0
 **/
@FeignClient("common-redis")
public interface CommonRedisFeignClient {

    //-------------------/service/redis
    @RequestMapping(value="/service/redis/user/insertUserToken",method= RequestMethod.POST)
    void insertUserToken(@RequestBody TbUser tbUser,@RequestParam("token") String token);

    @RequestMapping(value="/service/redis/user/getUserToken",method=RequestMethod.POST)
    public UserToken getUserToken(@RequestParam("token") String token);

    @RequestMapping(value="/service/redis/user/removeUserToken",method=RequestMethod.POST)
    void removeUserToken(@RequestParam("token") String token);

    //-----------------/redis/cart/
    @PostMapping("/redis/cart/insertToCart")
    void insertToCart(@RequestBody Map<String, Object> map);

    @GetMapping("/redis/cart/selectCartByUserId")
    Map<String, CartItem> selectCartByUserId(@RequestParam("userId") String userId);

}
